package jpa.entitys.promis.construction;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the PURCHASE_REQUEST_ITEMS database table.
 * 
 */
@Embeddable
public class PurchaseRequestItemPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(unique=true, nullable=false, length=30)
	private String project;

	@Column(name="POR_TYPE", unique=true, nullable=false, length=2)
	private String porType;

	@Column(name="POR_SERIES", unique=true, nullable=false, length=4)
	private String porSeries;

	@Column(name="POR_NO", unique=true, nullable=false, precision=6)
	private long porNo;

	@Column(name="POR_SEQ_NO", unique=true, nullable=false, precision=3)
	private long porSeqNo;

    public PurchaseRequestItemPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getProject() {
		return this.project;
	}
	public void setProject(String project) {
		this.project = project;
	}
	public String getPorType() {
		return this.porType;
	}
	public void setPorType(String porType) {
		this.porType = porType;
	}
	public String getPorSeries() {
		return this.porSeries;
	}
	public void setPorSeries(String porSeries) {
		this.porSeries = porSeries;
	}
	public long getPorNo() {
		return this.porNo;
	}
	public void setPorNo(long porNo) {
		this.porNo = porNo;
	}
	public long getPorSeqNo() {
		return this.porSeqNo;
	}
	public void setPorSeqNo(long porSeqNo) {
		this.porSeqNo = porSeqNo;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof PurchaseRequestItemPK)) {
			return false;
		}
		PurchaseRequestItemPK castOther = (PurchaseRequestItemPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.project.equals(castOther.project)
			&& this.porType.equals(castOther.porType)
			&& this.porSeries.equals(castOther.porSeries)
			&& (this.porNo == castOther.porNo)
			&& (this.porSeqNo == castOther.porSeqNo);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.project.hashCode();
		hash = hash * prime + this.porType.hashCode();
		hash = hash * prime + this.porSeries.hashCode();
		hash = hash * prime + ((int) (this.porNo ^ (this.porNo >>> 32)));
		hash = hash * prime + ((int) (this.porSeqNo ^ (this.porSeqNo >>> 32)));
		
		return hash;
    }
}